<%
 @task = task
 @user = task.user
 @project = task.project
 if(task.done==1); donestr = "done"; else; donestr=''; end
 if(task.star==1); starstr = "on"; else; starstr='off'; end
-%>
<li id="item_<%=task.id%>" onmouseout="mover('')">
<%= link_to_remote(image_tag("star_#{starstr}_2.gif", :id => "st#{task.id}", :border	 => "0"),
	:complete => "eval(request.responseText)",
   :url      =>  { :action => :star_it, :id=>task})
%>
<%= check_box("task", :done,  {:onfocus => "mover('d')", :onmouseover => "mover('d')", :onchange => "change('#{task.id}',event);", :class => donestr, :id => "d#{task.id}"}) %>
<%=text_field(:project, :name, {:onfocus => "mover('p')",:onmouseover => "mover('p')",:size => 4, :onkeyup => "change('#{task.id}',event);", :class => donestr, :id => "p#{task.id}"}) %>
<%=text_field("task", :priority, {:onfocus => "mover('pr')",:onmouseover => "mover('pr',this.value)",:size => 1,  :onkeyup => "change('#{task.id}',event);", :class => donestr, :id => "pr#{task.id}"}) %>
<%=text_field("task", :title, {:onfocus => "mover('t')",:onmouseover => "mover('t',this.value)",:size => 30,  :onkeyup => "change('#{task.id}',event);", :class => donestr, :id => "t#{task.id}"}) %>
<%=text_field(:user, :name, {:onfocus => "mover('r')",:onmouseover => "mover('r')",:size => 6, :onkeyup => "change('#{task.id}',event);", :class => donestr, :id => "r#{task.id}"}) %>
<%=text_field("task", :duedate, {:onfocus => "dispcal('#{task.id}',this.value);",:onmouseover => "mover('da')",:size => 6,:onkeyup => "change('#{task.id}',event);", :class => donestr, :id => "da#{task.id}"}) %>
<a href="#" onmouseover="mover('s')" onclick="save('<%=task.id%>');return false;"><img id="s<%=task.id%>" style="display:none;" src="/images/save.png" border="0"></a>
<a href="#" onmouseover="mover('n')" onclick="notes(<%=task.id%>);return false;"><img id="n<%=task.id%>" src="/images/notes.png" border="0"></a>
<a href="#" onmouseover="mover('de')" onclick="del(<%=task.id%>);return false;"><img id="de<%=task.id%>" src="/images/delete.gif" border="0"></a>

<% if(task.duedate != nil) -%>
<% if(task.duedate == Date.today) -%>
<div class="duetoday">today !</div>
<% elsif(task.duedate > Date.today and task.duedate <= Date.today+1) -%>
<div class="duetoday">tomorrow!</div>
<% elsif(task.duedate > Date.today and task.duedate <= Date.today+3) -%>
<div class="duenear"><%= time_ago_in_words(task.duedate+1) %></div>
<% elsif(task.duedate > Date.today) -%>
<div class="duefutur"><%= time_ago_in_words(task.duedate+1) %></div>
<% elsif(task.duedate < Date.today) -%>
<div class="duepast"><%= time_ago_in_words(task.duedate) + " ago !" %></div>
<% end -%>
<% end -%>
<% if(task.notes_count > 0) -%>
(<%= task.notes_count -%> notes)
<% end -%>
</li>
